<style>
  .picImg {
    width: 40px;
    height: 40px;
  }
</style>
<template>
  <div class="app-container">
    <!--&lt;!&ndash; 查询和其他操作 &ndash;&gt;-->
    <!-- 查询结果 -->
    <el-table v-loading="listLoading" :data="list" element-loading-text="正在查询中。。。" border fit highlight-current-row
              :header-cell-style="{background:'#92D3FF',color:'#fff'}">

      <!--<el-table-column fixed align="center" min-width="100" label="关联类型" prop="type">
        <template slot-scope="scope">
          <span>{{ scope.row.type ? '权益服务商' : '保代公司'}}</span>
        </template>
      </el-table-column>-->
      <el-table-column align="center" min-width="120" label="保险公司名称" prop="suranceName"/>
      <el-table-column align="center" min-width="120" label="保代公司名称" prop="agentName"/>
      <el-table-column align="center" min-width="120" label="保理公司名称" prop="factoringName"/>
      <el-table-column align="center" min-width="120" label="垫资额度 (万元)" prop="amount"/>
      <el-table-column align="center" min-width="120" label="垫资手续费 (‱)" prop="interestAll"/>
      <!--<el-table-column align="center" min-width="110" label="保理公司日息(‱)" prop="interestFactoring"/>
      <el-table-column align="center" min-width="200" label="服务费账户号" prop="serviceAccount"/>-->
      <el-table-column align="center" min-width="200" label="共管账户号" prop="account"/>
      <el-table-column align="center" min-width="200" label="共管账户名称" prop="accName"/>
      <el-table-column align="center" min-width="140" label="共管账户银行名称" prop="bankName"/>
      <!--<el-table-column align="center" min-width="200" label="共管开户号" prop="interBankNo"/>-->
      <el-table-column align="center" min-width="110" label="是否代付中转" prop="isRepay">
        <template slot-scope="scope">
          <span>{{ scope.row.isRepay ? '代付' : '不代付'}}</span>
        </template>
      </el-table-column>
      <el-table-column align="center" min-width="200" label="代付账号" prop="repayAccount"/>
      <el-table-column align="center" min-width="170" label="创建时间" prop="timeAdd"/>
      <!--<el-table-column fixed="right" align="center" label="操作" width="250" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button type="success" size="mini"
                     @click="handleCheck(scope.row)">垫资明细
          </el-button>
        </template>
      </el-table-column>-->
    </el-table>
    <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.pageSize"
                @pagination="getList"/>
    <!--垫资明细-->
    <el-dialog :visible.sync="editDialogVisible1" title="明细列表" width="800px" :close-on-click-modal="false">
      <el-table v-loading="listLoading1" :data="list1" element-loading-text="正在查询中。。。"
                border fit highlight-current-row :header-cell-style="{background:'#92D3FF',color:'#fff'}">

        <el-table-column align="center" min-width="100" label="保单号或合同号" prop="billNo"/>
        <el-table-column align="center" min-width="100" label="保单金额 (元)" prop="billAmount"/>
        <el-table-column align="center" min-width="100" label="代理手续费 (元)" prop="fee"/>
        <el-table-column align="center" min-width="100" label="代理人身份证号" prop="agentID"/>
        <el-table-column align="center" min-width="100" label="代理人编码" prop="agentNo"/>
        <!--<el-table-column align="center" min-width="100" label="是否需要垫资" prop="isAdvance">
          <template slot-scope="scope">{{{"0":"待确认","1":"不需要","2":"需要"}[scope.row.isAdvance]}} </template>
        </el-table-column>-->
      </el-table>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="editDialogVisible1 = false">确定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  import {doGet, doPost} from '@/api'
  import {cities} from '@/utils/base'
  import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
  import checkPermission from '@/utils/permission' // 权限判断函数

  export default {
    name: 'correlation',
    components: {Pagination},
    filters: {},
    data() {
      return {
        list: [],
        list1: [],
        total: 0,
        listLoading: true,
        listLoading1: false,
        editDialogVisible1: false,
        listQuery: {
          page: 1,
          pageSize: 20,
        }
      }
    },
    created() {
      this.getList()
    },
    methods: {
      checkPermission,

      // 获取三方关联列表
      getList() {
        this.listLoading = true
        doGet('corrsearch.html?op=list', this.listQuery).then(response => {
          this.list = response.rows
          this.total = response.data.totalcount
          this.listLoading = false
        }).catch(() => {
          this.list = []
          this.total = 0
          this.listLoading = false
        })
      },
        handleCheck(row) {
            this.list1 = [];
            this.editDialogVisible1 = true
            this.listLoading1=true
//        console.log(row.id)
            doGet('corrsearch.html?op=list', {id:row.id}).then(response => {
                this.list1=response.rows
//          console.log(response.rows);
                this.listLoading1=false
            }).catch(() => {
                this.list1 = [];
                this.total = 0;
                this.listLoading1=false
            })
        },
    }
  }
</script>
